﻿using furion.blog.Application.Contracts;
using furion.blog.Domain.Shared.Attribute;
using furion.blog.Domain.Shared.Enum;
using furion.blog.Utils;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;

namespace furion.blog.Web.Entry.Api
{
    /// <summary>
    /// 后台角色
    /// </summary>
    [ApiDescriptionSettings(Groups = new string[] { "RoleApi" })]
    [Route("api/role")]
    public class RoleApiController : IDynamicApiController
    {
        private readonly IRoleService _roleService;
        public RoleApiController(IRoleService roleService) {
            this._roleService = roleService;
        }


        [ActionAttribute(Name = "所有角色接口", Desc = "所有角色信息")]
        [HttpGet, Route("all")]
        public async Task<IActionResult> all()
        {
            var ret = await this._roleService.All(new Domain.Query.Role.RoleDetailQuery { IsDelete = YesOrNoEnum.No.ToString()});
            return new OkObjectResult(ResultUtil.Success(ret));
        }

    }
}
